package com.xncoding.easypoi.model;

import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl;
import cn.afterturn.easypoi.util.PoiPublicUtil;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.xncoding.easypoi.util.ExcelConvert;

import java.util.HashMap;
import java.util.Map;

public class ObjImportHandler extends ExcelDataHandlerDefaultImpl<AlarmObj> {
    static Map<String, String> fieldMap = new HashMap<>();
    static {
        fieldMap.put("1","b");
        fieldMap.put("2","c");
        fieldMap.put("3","d");
        fieldMap.put("5","f");
    }

    public Object importHandler(AlarmObj map, String originKey, Object value) {
//            super.importHandler(alarmObj,originKey,value);
//            Map<String, String> resMap = ExcelConvert.convertInput(alarmObj,fieldMap);
//            ObjTets objTets= BeanUtil.toBean(resMap, ObjTets.class);
//            System.out.println(JSON.toJSONString(objTets));
//            return super.importHandler(alarmObj,originKey,value);
        HashMap<String ,String> res = new HashMap<>();
        res.put(fieldMap.get(originKey.split("_")[1]),value.toString());

            return res;
    }


}
